﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "MessageThread.h"
#include <QtWidgets/QProgressBar>
#include <qpushbutton.h>
#include <QLabel>
#include <QHttpMultiPart>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QMetaObject>
#include <QFile>
#include <QNetworkRequest>
#include <downloadThread.h>
namespace Ui {
class MainWindow;
}

// FormMainCenter是主窗口的center widget
class FormMainCenter;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void paintEvent(QPaintEvent *);
    //重写定时器的事件   虚函数 子类重写父类的虚函数
    virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result);
    //接收子线程槽函数
    void receiveMsgFromThread(int);
    //子线程发射信号槽函数
    void sengMsgToThreadBtn();
    void dealDone();
protected:
signals:
    //给子线程发消息
    void sengMsgToThread(QString cid, QString path, HWND windID);
private  slots:
    /*void readContent();
    void replyFinished(QNetworkReply*);
    void loadError(QNetworkReply::NetworkError);
    void loadProgress(qint64 bytesSent, qint64 bytesTotal);*/
private:
    Ui::MainWindow *ui;
    FormMainCenter* centerWidget;
    MessageThread *messageThread;
    QProgressBar* progressBar;
    QPushButton*  uefiPushButton;
    QLabel* label_currentByte_value;
    QLabel* label_countSize_value;
    QLabel* label_currentByte;
    QLabel* label_countSize;
    QPushButton* pushButton_ModeDefault;
    QPushButton* pushButton_ModeISO;
    QNetworkAccessManager* manager;
    QNetworkReply* reply;
    QFile* file;
    DownloadThread* downloadThread;
    void downLoadBiosFiles(QString cid);
    /**void zipReader(QString fileName, QString unzipPath); */
    
};


#endif // MAINWINDOW_H
